package Config

import (
	"fmt"
	_ "github.com/go-sql-driver/mysql"
	"github.com/jinzhu/gorm"
	"ioc/server"
	"log"
)

type ServiceConfig struct {
}

func NewServiceConfig() *ServiceConfig {
	return &ServiceConfig{}
}

func (this *ServiceConfig) OrderService() *server.OrderServer {
	fmt.Println("我调用了")
	return server.NewOrderServer()
}
func (this *ServiceConfig) DbService() *gorm.DB {
	db, err := gorm.Open(
		"mysql",
		"root:654321@tcp(localhost:3306)/blog?charset=utf8",
	)
	if err != nil {
		log.Fatal(err)
	}
	db.DB().SetMaxOpenConns(100) //设置最大连接数
	return db
}
